package cn.haocxy.jfm.gui;

import javafx.scene.Node;
import javafx.scene.effect.DropShadow;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;


/**
 * 图标
 * 
 * @author 蔡心宇
 *
 */
class Icon {

	private static final DropShadow EFFECT;

	static {
		EFFECT = new DropShadow();
		EFFECT.setSpread(0.65);
		EFFECT.setColor(Color.LIGHTBLUE);
	}

	private final ImageView icon = new ImageView();
	
	public Icon(Image img) {
		icon.setImage(img);
	}
	
	public void update(boolean isHover) {
		if (isHover) {
			icon.setEffect(EFFECT);
		} else {
			icon.setEffect(null);
		}	
	}
	
	public void normal() {
		icon.setEffect(null);
	}
	
	public Node toNode() {
		return icon;
	}
}
